$(function () {
    $('#form').on('submit', function (e) {
        e.preventDefault()

        let str = decodeURIComponent($(this).serialize(), true)
        let xxx = getObj(str)
        let obj = document.getElementsByName("love");
        let array = []
        for (k in obj) {
            if (obj[k].checked) {
                array.push(obj[k].value)
            }
        }
        xxx.love = array.join(",")
        console.log(xxx);
    })

    function getObj(str) {
        var arr = []
        var array = []
        arr = str.split('&')
        // console.log(arr);
        var obj = new Object();
        for (var i = 0; i < arr.length; i++) {
            array = arr[i].split('=');
            var title = array[0]
            var key = array[1]
            obj[`${title}`] = key
        }
        return obj;
    }
})